package com.quanyan.travel.service;

import com.alibaba.rocketmq.common.message.MessageExt;
import com.quanyan.api.APIResponse;
import com.quanyan.common.Plugin.PageObj;
import com.quanyan.orderpay.response.mq.OrderNotifyMsg;
import com.quanyan.orderpay.response.mq.RefundNotifyMsg;
import com.quanyan.travel.api.req.ReqAccess;
import com.quanyan.travel.api.req.ReqOrderConfirmMsg;
import com.quanyan.travel.api.req.ReqOrderMsg;
import com.quanyan.travel.api.req.ReqSignUser;
import com.quanyan.travel.api.resp.RespActivitySignInfo;
import com.quanyan.travel.api.resp.RespOrderDetail;
import com.quanyan.travel.api.resp.RespOrderListMsg;
import com.quanyan.travel.api.resp.RespRefundOrderMsg;
import com.quanyan.travel.entity.TbOutdoorOrder;
import com.quanyan.travel.entity.vo.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 户外订单Service
 */

public interface TravelOrderService {

    APIResponse<RespActivitySignInfo> userSign(Integer uid, ReqSignUser reqSignUser);

    APIResponse userOrder(Integer uid, ReqOrderMsg reqOrderMsg, HttpServletRequest request) throws Exception;

    APIResponse<?> confirmOrder(Integer uid, ReqOrderConfirmMsg reqOrderConfirmMsg, HttpServletRequest request);

    APIResponse payCallback(MessageExt msg);

    void payCallback(OrderNotifyMsg orderNotifyMsg);

    APIResponse paySuccess(Integer uid, String orderNo, HttpServletRequest request);

    APIResponse refundCallback(MessageExt msg);

    void refundCallback(RefundNotifyMsg refundNotifyMsg);

    void refreshTravelStorage();

    /**
     *  处理异常订单的问题
     *
     **/
    void updateExceptionalOrderStatus(String orderNo);

    APIResponse cancelOrder(Integer uid, ReqOrderConfirmMsg reqOrderConfirmMsg);

    PageObj<List<RespOrderListMsg>> orderList(Integer uid, Integer pageNum, Integer pageSize);

    APIResponse<RespOrderDetail> orderDetail(Integer uid, String orderNo);

    APIResponse<RespRefundOrderMsg> preRefundOrder(String orderNo);

    APIResponse refundOrder(Integer uid, String orderNo, String reason) throws Exception;


    APIResponse passRefundOrder(String orderNo) throws Exception;


    APIResponse refundAllOrder(String orderNo) throws Exception;


    APIResponse access(Integer uid, ReqAccess reqAccess);


    boolean closeOrderCallback(String parentOrderNo);

    boolean closeOrder(String parentOrderNo, boolean isCallback);

    List<PayType> queryPayTypeList();

    boolean openPayType(List<Integer> list);

    String bookOrder(PrepareOrder prepareOrder, Integer uid) throws Exception;

    OrderAccumulate getOrderAccumulate(Integer uid, Double originalPrice);

    RefundOrderInfo getRefundOrderInfo(List<ProductDetail> productDetails, TbOutdoorOrder tbOutdoorOrder);

    List<String> remindOrderNoList(Integer uid);
}
